package com.zb.vo;

import com.zb.annotation.NumberPattern;
import com.zb.utils.VerificUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @Author WEN
 * @Date 2023/11/2 0002
 **/
@Data
@ApiModel("用户密码对象")
public class UserPasswordVo {
    @NotNull(message = "更改密码类型参数不能为空")
    @NumberPattern(regexp = "^(1|2)$", message = "更改密码类型参数不合法")
    @ApiModelProperty(value = "更改密码类型：1-验证码改密，2-输入旧密码更改密码", required = true, example = "1")
    private Integer type;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = VerificUtil.REGEX_PHONE, message = "手机号格式错误")
    @ApiModelProperty(value = "手机号", required = true)
    private String phone;

    @ApiModelProperty(value = "旧密码")
    private String oldPassword;

    @NotBlank(message = "新密码不能为空")
    @Length(min = 6, message = "请输入至少六位数的新密码")
    @ApiModelProperty(value = "新密码", required = true)
    private String newPassword;

    @ApiModelProperty(value = "验证码")
    private String code;
}
